<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('保险金统计列表')" />
    <th:block th:include="include :: layout-latest-css" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="gray-bg">
    <div class="ui-layout-west">
        <div class="box box-main">
            <div class="box-header">
                <div class="box-title">
                    <i class="fa icon-grid"></i> 组织机构
                </div>
                <div class="box-tools pull-right">
                    <button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
                    <button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
                    <button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新部门"><i class="fa fa-refresh"></i></button>
                </div>
            </div>
            <div class="ui-layout-content">
                <div id="tree" class="ztree"></div>
            </div>
        </div>
    </div>
    <div class="ui-layout-center">
        <div class="container-div">
            <div class="row">
                <div class="col-sm-12 search-collapse">
                    <form id="formId">
                        <input type="hidden" id="deptId" name="deptId">
                        <div class="select-list">
                            <ul>
                                <li>
                                    <label>工号：</label>
                                    <input type="text" name="userNo"/>
                                </li>
                                <li>
                                    <label>姓名：</label>
                                    <input type="text" name="userName"/>
                                </li>
                                <li>
                                    <label>性别：</label>
                                    <select name="userSex" th:with="type=${@dict.getType('sys_user_sex')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>用户类别：</label>
                                    <select name="userType" th:with="type=${@dict.getType('basic_user_type')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>技术类别：</label>
                                    <select name="technicalType" th:with="type=${@dict.getType('basic_user_technical')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>编制情况：</label>
                                    <select name="workDuty" th:with="type=${@dict.getType('basic_work_duty')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>职务级别：</label>
                                    <select name="dutyLevel" th:with="type=${@dict.getType('basic_duty_level')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>职位类别：</label>
                                    <select name="userPosition" th:with="type=${@dict.getType('basic_user_position')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>聘任等级：</label>
                                    <select name="postLevel" th:with="type=${@dict.getType('basic_post_level')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li class="select-time">
                                    <label>出生日期： </label>
                                    <input type="text" class="time-input" id="startTime1" placeholder="开始时间" name="params[beginTime1]"/>
                                    <span>-</span>
                                    <input type="text" class="time-input" id="endTime1" placeholder="结束时间" name="params[endTime1]"/>
                                </li>
                                <li class="select-time">
                                    <label>来院时间： </label>
                                    <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
                                    <span>-</span>
                                    <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
                                </li>
                                <li class="select-time">
                                    <label>统计月份： </label>
                                    <input type="text" class="time-input" id="startTime2" data-type="month" th:value="${startMonth}" placeholder="开始时间" name="params[beginTime2]"/>
                                    <span>-</span>
                                    <input type="text" class="time-input" id="endTime2" data-type="month" th:value="${endMonth}" placeholder="结束时间" name="params[endTime2]"/>
                                </li>
                                <li>
                                    <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                                </li>
                            </ul>
                        </div>
                    </form>
                </div>

                <a class="btn btn-warning" onclick="$.table.exportExcel()">
                    <i class="fa fa-download"></i> 导出
                </a>
                <div class="col-sm-12 select-table table-striped">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: layout-latest-js" />
    <th:block th:include="include :: ztree-js" />
    <th:block th:include="include :: bootstrap-table-export-js" />
    <th:block th:include="include :: bootstrap-table-fixed-columns-js" />
    <script th:inline="javascript">
        var prefix = ctx + "report/benefit";

        var sexs = [[${@dict.getType('sys_user_sex')}]];
        var types = [[${@dict.getType('basic_user_type')}]];
        var technicals = [[${@dict.getType('basic_user_technical')}]];
        var workDutys = [[${@dict.getType('basic_work_duty')}]];
        var dutyLevelDatas = [[${@dict.getType('basic_duty_level')}]];
        var postLevelDatas = [[${@dict.getType('basic_post_level')}]];

        $(function() {
            var panehHidden = false;
            if ($(this).width() < 769) {
                panehHidden = true;
            }
            $('body').layout({ initClosed: panehHidden, west__size: 185 });
            // 回到顶部绑定
            if ($.fn.toTop !== undefined) {
                var opt = {
                    win:$('.ui-layout-center'),
                    doc:$('.ui-layout-center')
                };
                $('#scroll-up').toTop(opt);
            }
            queryReportList();
            queryDeptTree();
        });

        function queryReportList() {
            var options = {
                url: prefix + "/reportList",
                exportUrl: prefix + "/export",
                modalName: "保险金报表",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                showExport: false,
                fixedColumns: true,
                fixedNumber: 5,
                columns: [
                    [{
                        field: 'benefitMonth',
                        title: '保险金月份',
                        rowspan: 2
                    },
                        {
                            field: 'userNo',
                            title: '工号',
                            rowspan: 2
                        },
                        {
                            field: 'userName',
                            title: '姓名',
                            rowspan: 2
                        },
                        {
                            field: 'userSex',
                            title: '性别',
                            rowspan: 2,
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(sexs, value);
                            }
                        },
                        {
                            field: 'userType',
                            title: '用户类别',
                            rowspan: 2,
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(types, value);
                            }
                        },
                        {
                            field: 'idCard',
                            title: '身份证号',
                            rowspan: 2
                        },
                        {
                            field: 'birthday',
                            title: '出生年月',
                            rowspan: 2
                        },
                        {
                            field: 'technicalType',
                            title: '技术类别',
                            rowspan: 2,
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(technicals, value);
                            }
                        },
                        {
                            field: 'hospitalTime',
                            title: '来院时间',
                            rowspan: 2
                        },
                        {
                            field: 'workDuty',
                            title: '编制情况',
                            rowspan: 2,
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(workDutys, value);
                            }
                        },
                        {
                            field: 'dutyLevel',
                            title: '级别',
                            rowspan: 2,
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(dutyLevelDatas, value);
                            }
                        },
                        {
                            field: 'obtainLevel',
                            title: '职称聘任等级',
                            rowspan: 2,
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(postLevelDatas, value);
                            }
                        },
                        {
                            field: 'postLevel',
                            title: '职称聘任等级',
                            rowspan: 2,
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(postLevelDatas, value);
                            }
                        },
                    {
                        title : '机关事业养老',
                        align : 'center',
                        valign : 'center',
                        colspan : 2
                    },
                    {
                        title : '企业养老',
                        align : 'center',
                        valign : 'center',
                        colspan : 2
                    },
                    {
                        title : '失业保险',
                        align : 'center',
                        valign : 'center',
                        colspan : 2
                    },
                    {
                        title : '医疗保险',
                        align : 'center',
                        valign : 'center',
                        colspan : 2
                    },
                    {
                        field: "e",
                        title : '工伤保险',
                        align : 'center',
                        valign : 'center',
                        rowspan: 2
                    },
                    {
                        title : '职业年金',
                        align : 'center',
                        valign : 'center',
                        colspan : 2
                    },
                    {
                        field: 'g',
                        title : '公务员医疗',
                        align : 'center',
                        valign : 'center',
                        rowspan : 2
                    },
                    {
                        title : '企业年金',
                        align : 'center',
                        valign : 'center',
                        colspan : 2
                    },
                    {
                        title : '公积金',
                        align : 'center',
                        valign : 'center',
                        colspan : 2
                    },
                    {
                        field: 'k',
                        title : '滞纳金',
                        align : 'center',
                        valign : 'center',
                        rowspan : 2
                    }],
                    [{
                        field: 'a1',
                        title: '单位'
                    },
                    {
                        field: 'a2',
                        title: '个人'
                    },
                    {
                        field: 'b1',
                        title: '单位'
                    },
                    {
                        field: 'b2',
                        title: '个人'
                    },
                    {
                        field: 'c1',
                        title: '单位'
                    },
                    {
                        field: 'c2',
                        title: '个人'
                    },
                    {
                        field: 'd1',
                        title: '单位'
                    },
                    {
                        field: 'd2',
                        title: '个人'
                    },
                    {
                        field: 'f1',
                        title: '单位'
                    },
                    {
                        field: 'f2',
                        title: '个人'
                    },
                    {
                        field: 'h1',
                        title: '单位'
                    },
                    {
                        field: 'h2',
                        title: '个人'
                    },
                    {
                        field: 'j1',
                        title: '单位'
                    },
                    {
                        field: 'j2',
                        title: '个人'
                    }]
                ]
            };
            $.table.init(options);
        }

        function queryDeptTree()
        {
            var url = ctx + "system/dept/treeData";
            var options = {
                url: url,
                expandLevel: 1,
                onClick : zOnClick
            };
            $.tree.init(options);

            function zOnClick(event, treeId, treeNode) {
                $("#deptId").val(treeNode.id);
                $.table.search();
            }
        }

        $('#btnExpand').click(function() {
            $._tree.expandAll(true);
            $(this).hide();
            $('#btnCollapse').show();
        });

        $('#btnCollapse').click(function() {
            $._tree.expandAll(false);
            $(this).hide();
            $('#btnExpand').show();
        });

        $('#btnRefresh').click(function() {
            queryDeptTree();
        });
    </script>
</body>
</html>